package com.llh.designpatterns.singleton.hungry;

/**
 * <h2>饿汉式单例</h2>
 * <p>基于静态变量/代码块实现</p>
 * <p>CreatedAt: 2019-11-23 19:56</p>
 * <p><a href="mailto:forever2y_y@163.com">SendMailToMe</a></p>
 *
 * @author llh
 */
class Singleton {
    private Singleton() {
    }

    private final static Singleton instance = new Singleton();

//-----------------静态代码块写法-------------------
//    private static Singleton instance;
//    static {
//        instance = new Singleton();
//    }
//-----------------静态代码块写法-------------------

    static Singleton getInstance() {
        return instance;
    }


}
